using UnityEngine;
using System.Collections;

/// <summary>
/// 전체적으로 공용으로 사용할 함수들을 모아두는 곳.
/// </summary>
public class SystemCore {
	
	
	/// <summary>
	/// Resource폴더 위치를 각 버전에 맞게 받아온다.
	/// 현재 지원기능: IPhone, Unity Editor
	/// </summary>
	/// <returns>
	/// A Path <see cref="System.String"/>
	/// </returns>
	static public string GetAssetPath()
	{
		string root = string.Format( "{0}/../../Documents", Application.dataPath );
		if( LCFileManager.DirectoryExists(root) )
		{
			// iphone
			return root;
		}
		else
		{
		
#if UNITY_EDITOR
			// Unity Editor (PC)
			root = string.Format( "{0}/..", Application.dataPath );
#elif UNITY_ANDROID
			root = string.Format( "{0}", Application.persistentDataPath );
#elif UNITY_STANDALONE_OSX
			string tmp    = Application.dataPath;
			string[] path = tmp.Split("/"[0]);				
			tmp = "";
			for(int i=0;i<path.Length-2;i++){
				tmp += path[i];
				if( i < path.Length-3) tmp += "/";
			}
			root = string.Format( "{0}", tmp );
#elif UNITY_STANDALONE_WIN
			string tmp    = Application.dataPath;
			string[] path = tmp.Split("/"[0]);				
			tmp = "";
			for(int i=0;i<path.Length-1;i++){
				tmp += path[i] + "/";
			}
			root = string.Format( "{0}", tmp );
#endif
			return root;
		}
	}
	
}
